Optimization of a process involving transformation of multiple source media streams into product streams can be very difficult. The media flows proceed continuously in time and are subject to various constraints. Some of the flows are fixed at all times—these are either sources of raw materials that need to be processed with no storage available, or products, whose demands must be satisfied. Some flows are not limited to specific values at each time; instead, total amount of a source consumed, or a product generated for a fixed period of time is set by a contract to a specific target. A deviation from the contracted targets is usually heavily penalized. Some products/source flows are restricted only within certain interval limits. Some flows (products, sources or intermediates) can be stored, usually at additional costs, thus increasing the number of degrees of freedom. The goal is to operate the plant in the most economical way, which typically involves choosing a feasible mixture of products/sources resulting in contract fulfillment and the largest difference between products sales and raw material costs. Due to the presence of periodic contracts and storages, this optimization problem is a dynamic one and has to be solved on a (sufficiently long) time horizon. The main challenge comes from the fact that fulfillment of the contracts in the future influences the present decisions; these decisions are highly sensitive to estimated future trajectories of the fixed source and product streams that are inherently uncertain.